// const path=require('path');
// const _=require('lodash');

class BaseHandler {
  async restSuccess(ctx, ret) {
    ctx.response.type = "json";
    ctx.response.body = {
      result: true,
      data: ret,
    };
  }

  async restError(ctx, error_code, error_message) {
    ctx.response.type = "json";

    ctx.response.body = {
      result: false,
      error_code,
      error_message,
    };
  }

  async download(ctx, { file, option }) {
    ctx.response.attachment(file, option);
  }
}

module.exports = BaseHandler;
